﻿using System;
using System.Buffers;
using System.Net.Sockets.Kcp;

/// <summary>
/// kcp回调
/// </summary>
public class KcpCallback : IKcpCallback
{ 
    /// <summary>
    /// kcp 发送方向输出
    /// </summary>
    public Action<Memory<byte>> OnOutput;
     
    public IMemoryOwner<byte> RentBuffer(int lenght)
    {
        return null;
    }

    public void Output(IMemoryOwner<byte> buffer, int avalidLength)
    {
        using (buffer)
        {
            OnOutput(buffer.Memory.Slice(0, avalidLength));
        }
    }
}